package Offer;

public class Test42a 
{

	public static void main(String[] args) 
	{
		char[] ch={'a','b','c','d','e'};
		reverse(ch,6);

	}
	public static void reverse(char[] ch,int index)
	{
		if(ch==null||ch.length<index+1)
			return;
		reverse(ch,0,index);
		reverse(ch,index+1,ch.length-1);
		reverse(ch,0,ch.length-1);
		for(int i=0;i<ch.length;i++)
	    {
	        System.out.print(ch[i]);
	    }
	}
	public static void reverse(char[] ch,int start,int end)
    {
	   if(start==end)
	      return;
	   while(start<end)
       {
    		char temp = ch[start];
    		ch[start]=ch[end];
    		ch[end]=temp;
    		start++;
    		end--;
	   }
	}
}
